package edu.neusoft.springhtmldemo.controller;

import edu.neusoft.springhtmldemo.domain.OperatingLog;
import edu.neusoft.springhtmldemo.service.OperatingLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class OperatingLogController {
    @Autowired
    private OperatingLogService service;
    @RequestMapping("showOperatingLog")
    public List<OperatingLog> showOperatingLog(){
        List<OperatingLog> lists=service.showAll();
        return lists;
    }

    @RequestMapping("selectOperatingLog")
    public List<OperatingLog> selectOperatingLog(String oid,String userName,String operateDetail,String alarmBeginTime){
        System.out.println(oid+"-"+userName+"-"+operateDetail+"-"+alarmBeginTime);
        if (alarmBeginTime.length()>0){
            alarmBeginTime=alarmBeginTime.substring(0,10);
        }
        return service.selectOperatingLog(oid,userName,operateDetail,alarmBeginTime);
    }
}
